package educar.controllers;

import educar.gui.AdminView;
import educar.gui.IView;
import educar.models.Alumno;
import educar.models.Cargo;
import educar.models.Docente;
import educar.models.Facultad;
import educar.models.Materia;

public class AdminViewController implements IController {
	AdminView view;

    public void setView(IView view)
    {
        this.view = (AdminView) view;
    }
    
    public void process (String model)
    {
    	if (model.compareTo(AdminView.SALIR) == 0)
    		salir();
    	else if (model.compareTo(AdminView.REFRESCAR) == 0)
    		refrescar();
    		
    }
	private void refrescar() {
        
		String[] alumnos;
        alumnos = Alumno.getAllArray();
        ((AdminView)view).setAlumnos(alumnos);
        
        String[] c = Cargo.getAllCargosArray();
        ((AdminView)view).setCargos(c);
        
        ((AdminView)view).setDocentes(Docente.getAllArray());

        String[] f = Facultad.getAllCodigosArray();
        ((AdminView)view).setFacultades(f);
        
        String[] ca = Materia.getAllMateriasArray();
        ((AdminView)view).setMaterias(ca);
        
        
	}
	private void salir() {
		System.exit(0);
	}
	@Override
	public void processItemList(String name, String item) {
		// TODO Auto-generated method stub
		
	}
    }

	
	
